module Resoconti::MovimentiMagazzinoHelper
  def movimento_magazzino_riferimento_id_form_column(record, options)
    if record.tipo_movimento_magazzino
      record_select_options = {
        :controller => active_scaffold_controller_for(record.tipo_movimento_magazzino.riferimento_type.constantize).controller_path,
        :id => options[:id],
        :params => {:filter => record.tipo_movimento_magazzino.filtro_riferimento}
      }
      record_select_options.merge!(active_scaffold_input_text_options)
      record_select_field options[:name], record.riferimento,record_select_options
    else
      select_options = []
      AS_select(options, select_options)
    end
  end
  
  def movimento_magazzino_riferimento_id_form_column(record, options)
      record_select_options = {
        :controller => 'anagrafiche/partners',
        :id => options[:id]
      }
      record_select_options.merge!(active_scaffold_input_text_options)
      record_select_field options[:id], record.riferimento,record_select_options
  end

end
